<?php
    // array for JSON response
    $response = array();
    // include db connect class
    require_once __DIR__ . '/db_connect.php';
    // connecting to db
    $db = new DB_CONNECT();
    if(isset($_GET['userIdZing'])){
        $result = mysql_query("SELECT user_name_zing, user_avatar_zing FROM user WHERE user_id_zing =".$_GET['userIdZing']) or die(mysql_error());
        if (mysql_num_rows($result) > 0) {
                $response["user"] = array();
                while ($row = mysql_fetch_array($result)) {
                        $user = array(); 
                        $user['user_id_zing'] = $_GET['userIdZing'];
                        $user['user_name_zing'] = $row['user_name_zing'];
                        $user['user_avatar_zing'] = $row['user_avatar_zing'];
                        // push single product into final response array
                        array_push($response['user'],$user);
                }
                // success
            $response["success"] = 1;
            echo json_encode($response);
        }
        else{
            $response["success"] = 0;
                echo json_encode($response);
        }
    }
?>

